{template header}
{if $tips}
<div class="alert">{$tips}<a class="close" data-dismiss="alert" href="#">&times;</a></div>
{else}
<style type="text/css">
    td.comment{max-width: 600px; text-indent: inherit;word-wrap:break-word;word-break:normal;}
</style>
<div class="bs-docs-example" style="clear:both;">
    <table class="table table-striped">
        <thead>
            <tr>
                <th>评论ID</th>
                <th>楼层</th>
                <th>用户昵称</th>
                <th>评论内容</th>
                <th>添加时间</th>
                <th>点亮</th>
                <th>显示</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
         {loop $allcomment $k $v}
    <tr {if $v['comment_id']==$default} style="color:green " {/if}>
                <td>{$v['comment_id']}</td>
                <td>{$v['floor']}</td>
                <td>{$v['nickname']}</td>
                <td class="comment">{$v['comment_content']}</td>
                <td>{eval echo date('Y-m-d H:i:s', $v['add_time'])}</td>
                <td>{$v['lights']}</td>
                <td><img src="static/bootstrap/img/cms/icon_{if $v['is_show'] == 1}right{else}wrong{/if}.jpg" width="30" height="30"></td>
                <td>
                    {if $v['is_show'] == 1}
                    <a class="btn btn-danger" href="?c=admin&a=eidtNewsComment&type=hidden&comment_id={$v['comment_id']}&news_id={$v['news_id']}">隐藏</a>
                    {else}
                    <a class="btn btn-primary" href="?c=admin&a=eidtNewsComment&type=show&comment_id={$v['comment_id']}&news_id={$v['news_id']}">显示</a>
                    {/if}
                    {if $v['comment_id']==$default}
                         <a class="btn btn-danger del_ans"> 取消默认</a>
                    {else}
                    <a class="btn btn-primary default_ans"  data-comm="{$v['comment_id']}">设为默认</a>
                    {/if}
                    <a class="btn btn-primary" href="index.php?c=admin&a=recomment&news_id={$v['news_id']}&f_id={$v['comment_id']}">回复</a>

                </td>
            </tr>
            {/loop}
        </tbody>
    </table>
</div>
<div class="pagination">
    <ul>
        {$pageStr}
    </ul>
</div>
{/if}
<script type="text/javascript">


 var newid={$news_id};   
$('.default_ans').on('click',function(){
    comm=$(this).attr('data-comm');
    $.ajax({
        url:'/adminajax/defaultAns',
        data:{comm:comm,new:newid},
        success:function(res){
            location.href=''
        }      
    })
})
$('.del_ans').on('click',function(){
    comm=$(this).attr('data-comm');
    $.ajax({
        url:'/adminajax/deldefaultAns',
        data:{new:newid},
        success:function(res){
            location.href=''
        }      
    })
})
</script>
{template footer}
<script>

</script>